package com.fanrui.code.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPool {

	private ExecutorService threadPool;
	
	public ThreadPool(String threadName) {
		threadPool = Executors.newFixedThreadPool(1, new NamedThreadFactory(threadName + "-"));
	}
	
	public ThreadPool(String threadName,int threadNumber) {
		threadPool = Executors.newFixedThreadPool(threadNumber, new NamedThreadFactory(threadName+ "-"));
	}
	
	public void execute(Runnable command) {
		threadPool.execute(command);
	}
	
}
